<html><head>
  <meta charset="utf-8">
  <#assign base=request.contextPath  />
  <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  <title>日常护理记录</title>
  <link rel="stylesheet" href="${base}/js/layui/css/layui.css" media="all">
  <script type="text/javascript" src="${base}/js/zhang.js"></script>
<style type="text/css">
 form{
           padding: 20px;
             }
      .layui-btn-radius{
           border-radius: 5px;
          }
</style>
</head>

<body>
 <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
  <legend>日常护理记录</legend>
</fieldset>
<div class="demoTable"style="padding:15px;">
        <button class="layui-btn layui-btn-radius" id="btn2" data-method="offset" type="button" style="background-color: #0092EF;">录入日常护理记录</button>
        <div class="layui-inline layui-form" style="float:right;" >
        <div class="layui-input-inline">
            <select name="modules" lay-verify="required" id="sech" lay-search="">
                <option value="">请选择要搜索的列</option>
                <option value="room_name">房间号</option>
                <option value="Beonduty">护士</option>
                <option value="Contactnumber">联系电话</option>
                <option value="remarks">备注</option>
            </select>
        </div>
    	  <div class="layui-inline">
    	    <input class="layui-input" name="id" id="demoReload" autocomplete="off">
    	  </div>
    	  <button class="layui-btn layui-btn-radius" id="btn1" data-type="reload" style="background-color: #0092EF;">搜索</button>
    </div>
  </div>
<table class="layui-hide" id="ttt" lay-filter="user"></table>
<script type="text/html" id="barDemo">
  <i class="layui-icon layui-icon-edit" lay-event="edit" id="updatework" style="font-size: 20px;"></i>&nbsp;&nbsp;&nbsp;
  <i class="layui-icon layui-icon-delete layui-btn-xs" lay-event="del" id="delectwork" href="javascript:void(0)"  onclick="delectwork('{{d.id}}')"  style="font-size: 20px;" ></i>
</script>

<script src="${base}/js/layui/layui.js" charset="utf-8"></script>
<script src="${base}/js/jquery.min.js"></script>
<script>
layui.use(['form', 'layedit', 'laydate','table'], function(){
   var form = layui.form
   ,$ = layui.jquery
   ,layer = layui.layer
   ,layedit = layui.layedit
   ,laydate = layui.laydate
  table = layui.table;
  table.render({
    elem: '#ttt'
    ,url: '${base}/workguidace/selectWorkguidace'
    ,toolbar: '#toolbarDemo'
        ,defaultToolbar: ['filter', 'print', 'exports']
    ,cols: [[
      {field:'date',templet:function(val){ return changeDateFormat(val.date); },title: '日期',align:'center',fixed: true}
      ,{field:'room_name',title: '房间号',align: 'center'}
      ,{field:'beonduty',title: '护士',align:'center'}
      ,{field:'dutyrecord',templet:function(val){  return changeDateFormat(val.dutyrecord); },title: '交班时间',align:'center'}
      ,{field:'contactnumber', title: '联系电话',align:'center'}
      ,{field:'remarks', title: '备注',align:'center'}
       ,{fixed: 'right', title:'操作', toolbar: '#barDemo',width:150, align: 'center'}
    ]]
    ,id: 'testReload'
    ,page: {
              layout: ['limit', 'count', 'prev', 'page', 'next', 'skip'] //自定义分页布局
              ,theme: '#0092EF'
              ,limit:20
            }
    ,height:500
   ,done: function(res, curr, count){
                this.where={};
            }
  });

    $('#btn1').on('click', function(){
       var sechLin=$("#sech").val();
       var sechData=$("#demoReload").val();
       var whereData={};
       whereData.lin=sechLin;
       whereData.data=Trim(sechData);
       whereData.page=1;
       whereData.limt=10;
       var table = layui.table;
                    //表刷新方法
                    table.reload('testReload', {
                        url: '${base}/workguidace/selectWorkguidace'
                        ,where: whereData
                    });
    });
   var active = {
      	offset: function(othis){
      	  var type = othis.data('type')
      	  ,text = othis.text();
  		  layer.open({
  		  type: 2,
  		  title: '录入信息',
  		  shadeClose:false ,
  		  area:['455px','400px'],
  		  content: '${base}/workguidace/workgui_Add',

  		});
  	}
    };
     $('#btn2').on('click', function(){
      var othis = $(this), method = othis.data('method');
      active[method] ? active[method].call(this, othis) : '';
    });

//编辑弹出层
   /* table.on('tool(user)', function(obj){
      var layEvent = obj.event;
      if(layEvent=="edit"){
                 var data = obj.data;
                  //示范一个公告层
                  layer.open({
                      type: 2,
                      title: '修改信息',
                      shadeClose:false ,
                      offset: 't',
                      area:['100%','100%'],
                      content: '${base}/workguidace/nurse?homeId=\'+data.homeId',
                      success: function (layero, index) {
                        var iframeWin = window[layero.find('iframe')[0]['name']];//得到iframe页的窗口对象，执行iframe页的方法：iframeWin.method();
                          //房间号
                          iframeWin.$("#room_name").val(data.room_name)
                          //妈妈姓名
                          iframeWin.$("#username").val(data.username)
                          //产妇入住天数
                          iframeWin.$("#days").val(data.days)
                            //责任护士 responsible
                          iframeWin.$("#responsible").val(data.responsible)
                          //班次 shift
                          iframeWin.$("#shift").val(data.shift)
                          //分娩时间 deliverTime
                          iframeWin.$("#deliverTime").val(GetDateByShiJianChuo(data.deliverTime))
                          //血压 bloodpressure
                          iframeWin.$("#bloodpressure").val(data.bloodpressure)
                          //脉搏
                          iframeWin.$("#pulse").val(data.pulse)
                          //体温
                          iframeWin.$("#temperature1").val(data.temperature1)
                          //备注 remarks1
                          iframeWin.$("#remarks1").val(data.remarks1)
                          //宝宝姓名
                          iframeWin.$("#name").val(data.name)
                          //宝宝天数
                          iframeWin.$("#day").val(data.day)
                          //宝宝 育婴师 babynursery
                          iframeWin.$("#babynursery").val(data.babynursery)
                          //护理类型 ofnursing
                          iframeWin.$("#ofnursing").val(data.ofnursing)
                          //分娩方式 delivery
                          iframeWin.$("#delivery").val(data.delivery)
                          //黄疸 jaundice
                          iframeWin.$("#jaundice").val(data.jaundice)
                          //备注 remarks2
                          iframeWin.$("#remarks2").val(data.remarks2)
                          //体温 temper
                          iframeWin.$("#temper").val(data.temper)
                          /!*iframeWin.$("#home_id").val(data.roomId)
                           iframeWin.$("#beonduty").val(data.beonduty)
                            iframeWin.$("#roomId").val(data.roomId)
                            iframeWin.$("#room_name").val(data.room_name)
                            iframeWin.$("#test5").val( changeDateFormat(data.date))
                            iframeWin.$("#contactnumber").val(data.contactnumber)
                            iframeWin.$("#remarks").val(data.remarks)
                            iframeWin.$("#workId").val(data.id)*!/
                          setTimeout(function(){
                              iframeWin.$("#roomId option[value='"+data.roomId+"']").attr("selected", "selected");
                              iframeWin.layui.form.render()
                                },500)
                      }
                  });
      }

    table.on('tool(user)', function(obj){
        var layEvent = obj.event;
        if(layEvent=="edit"){
            var data = obj.data;
            //示范一个公告层
            layer.open({
                type: 2,
                title: '修改信息',
                shadeClose:false ,
                offset: 't',
                area:['100%','100%'],
                content: '${base}/workguidace/nurse?homeId=\'+data.homeId',
                success: function (layero, index) {
                    var iframeWin = window[layero.find('iframe')[0]['name']];//得到iframe页的窗口对象，执行iframe页的方法：iframeWin.method();
                    //房间号
                    iframeWin.$("#room_name").val(data.room_name)
                    //妈妈姓名
                    iframeWin.$("#username").val(data.username)
                    //产妇入住天数
                    iframeWin.$("#days").val(data.days)
                    //责任护士 responsible
                    iframeWin.$("#responsible").val(data.responsible)
                    //班次 shift
                    iframeWin.$("#shift").val(data.shift)
                    //分娩时间 deliverTime
                    iframeWin.$("#deliverTime").val(GetDateByShiJianChuo(data.deliverTime))
                    //血压 bloodpressure
                    iframeWin.$("#bloodpressure").val(data.bloodpressure)
                    //脉搏
                    iframeWin.$("#pulse").val(data.pulse)
                    //体温
                    iframeWin.$("#temperature1").val(data.temperature1)
                    //备注 remarks1
                    iframeWin.$("#remarks1").val(data.remarks1)
                    //宝宝姓名
                    iframeWin.$("#name").val(data.name)
                    //宝宝天数
                    iframeWin.$("#day").val(data.day)
                    //宝宝 育婴师 babynursery
                    iframeWin.$("#babynursery").val(data.babynursery)
                    //护理类型 ofnursing
                    iframeWin.$("#ofnursing").val(data.ofnursing)
                    //分娩方式 delivery
                    iframeWin.$("#delivery").val(data.delivery)
                    //黄疸 jaundice
                    iframeWin.$("#jaundice").val(data.jaundice)
                    //备注 remarks2
                    iframeWin.$("#remarks2").val(data.remarks2)
                    //体温 temper
                    iframeWin.$("#temper").val(data.temper)
                    /!*iframeWin.$("#home_id").val(data.roomId)
                    iframeWin.$("#beonduty").val(data.beonduty)
                    iframeWin.$("#roomId").val(data.roomId)
                    iframeWin.$("#room_name").val(data.room_name)
                    iframeWin.$("#test5").val( changeDateFormat(data.date))
                    iframeWin.$("#contactnumber").val(data.contactnumber)
                    iframeWin.$("#remarks").val(data.remarks)
                    iframeWin.$("#workId").val(data.id)*!/
                    setTimeout(function(){
                    iframeWin.$("#roomId option[value='"+data.roomId+"']").attr("selected", "selected");
                    iframeWin.layui.form.render()
                },500)
        }
    });
}*/

//编辑弹出层
    table.on('tool(user)', function(obj){
        var layEvent = obj.event;
        if(layEvent=="edit"){
            var data = obj.data;
            //示范一个公告层
            layer.open({
                type: 2,
                title: '修改信息',
                shadeClose:false ,
                area:['455px','400px'],
                content: '${base}/workguidace/workgui_Edit',
                success: function (layero, index) {
                    var iframeWin = window[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象，执行iframe页的方法：iframeWin.method();
                    iframeWin.$("#home_id").val(data.roomId)
                    iframeWin.$("#beonduty").val(data.beonduty)
                    iframeWin.$("#roomId").val(data.roomId)
                    iframeWin.$("#room_name").val(data.room_name)
                    iframeWin.$("#test5").val( changeDateFormat(data.date))
                    iframeWin.$("#contactnumber").val(data.contactnumber)
                    iframeWin.$("#remarks").val(data.remarks)
                    iframeWin.$("#workId").val(data.id)
                    setTimeout(function(){
                        iframeWin.$("#roomId option[value='"+data.roomId+"']").attr("selected", "selected");
                        iframeWin.layui.form.render()
                    },500)

                }
            });
        }
    });





   /* table.on('tool(user)', function(obj){
        var layEvent = obj.event;
        if(layEvent=="edit"){
            var data = obj.data;
            //示范一个公告层
            layer.open({
                type: 2,
                title: '修改信息',
                shadeClose:false ,
                offset: 't',
                area:['100%','100%'],
                content: '${base}/workguidace/nurse?homeId=\'+data.homeId',
                success: function (layero, index) {
                    var iframeWin = window[layero.find('iframe')[0]['name']];//得到iframe页的窗口对象，执行iframe页的方法：iframeWin.method();
                    //房间号
                    iframeWin.$("#room_name").val(data.room_name)
                    //妈妈姓名
                    iframeWin.$("#username").val(data.username)
                    //产妇入住天数
                    iframeWin.$("#days").val(data.days)
                    //责任护士 responsible
                    iframeWin.$("#responsible").val(data.responsible)
                    //班次 shift
                    iframeWin.$("#shift").val(data.shift)
                    //分娩时间 deliverTime
                    iframeWin.$("#deliverTime").val(GetDateByShiJianChuo(data.deliverTime))
                    //血压 bloodpressure
                    iframeWin.$("#bloodpressure").val(data.bloodpressure)
                    //脉搏
                    iframeWin.$("#pulse").val(data.pulse)
                    //体温
                    iframeWin.$("#temperature1").val(data.temperature1)
                    //备注 remarks1
                    iframeWin.$("#remarks1").val(data.remarks1)
                    //宝宝姓名
                    iframeWin.$("#name").val(data.name)
                    //宝宝天数
                    iframeWin.$("#day").val(data.day)
                    //宝宝 育婴师 babynursery
                    iframeWin.$("#babynursery").val(data.babynursery)
                    //护理类型 ofnursing
                    iframeWin.$("#ofnursing").val(data.ofnursing)
                    //分娩方式 delivery
                    iframeWin.$("#delivery").val(data.delivery)
                    //黄疸 jaundice
                    iframeWin.$("#jaundice").val(data.jaundice)
                    //备注 remarks2
                    iframeWin.$("#remarks2").val(data.remarks2)
                    //体温 temper
                    iframeWin.$("#temper").val(data.temper)
                    /!*iframeWin.$("#home_id").val(data.roomId)
                     iframeWin.$("#beonduty").val(data.beonduty)
                      iframeWin.$("#roomId").val(data.roomId)
                      iframeWin.$("#room_name").val(data.room_name)
                      iframeWin.$("#test5").val( changeDateFormat(data.date))
                      iframeWin.$("#contactnumber").val(data.contactnumber)
                      iframeWin.$("#remarks").val(data.remarks)
                      iframeWin.$("#workId").val(data.id)*!/
                    setTimeout(function(){
                        iframeWin.$("#roomId option[value='"+data.roomId+"']").attr("selected", "selected");
                        iframeWin.layui.form.render()
                    },500)
                }
            });
        }
    });*/
//清空搜索框
    layui.form.on('select()', function(data){
    $("#demoReload").val("")
  });
 });

 function delectwork(id){
 layer.confirm('真的要删除吗?', function(index){
  $.ajax({
     type:"POST",
        url:"${base}/workguidace/deleteWorkguidace",
        data:{"id":id},
            success : function(data){
            var table = layui.table;
             //表刷新方法
               table.reload('testReload', {
                    url: '${base}/workguidace/selectWorkguidace'
                       ,where: {} //设定异步数据接口的额外参数
                                   });
                                     layer.close(index);
                        }
                  });
 } );
 }
 //键盘事件
     $("body").bind("keydown",function(e){
         // 兼容FF和IE和Opera
         var theEvent = e || window.event;
         var code = theEvent.keyCode || theEvent.which || theEvent.charCode;
         if (code == 13) {
             //回车执行查询
             $("#btn1").click();
         }
     });


</script>

</body>
</html>